/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.ufc.quixada.adrs.comandos.supervisor;

import br.ufc.quixada.adrs.interfaces.Comando;
import br.ufc.quixada.adrs.model.Administrador;
import br.ufc.quixada.adrs.service.AdministradorService;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 *
 * @author Franklin
 */
public class CmdAlterarAdministrador implements Comando {

    public String executa(HttpServletRequest request, HttpServletResponse response) {
        HttpSession session = request.getSession();
        AdministradorService administradorService = new AdministradorService();
        Administrador administrador = administradorService.getAdministradorById(Long.parseLong(request.getParameter("id_administrador")));

        session.setAttribute("atualizar_administrador", administrador);
        return "/ServletCentral?comando=CmdCarregarEstadosSupervisor";
    }
}